package cz.cvut.kadledav.paa.knapsack.bo;

/**
 * User: David Kadlecek
 * Date: 8.10.13
 */
public class InstanceCategorySolution {

    private long averageTime;
    private double avgRelativeDeviation;
    private double maxRelativeDeviation;
    private int categoryNumber;

    public long getAverageTime() {
        return averageTime;
    }

    public void setAverageTime(long averageTime) {
        this.averageTime = averageTime;
    }

    public double getAvgRelativeDeviation() {
        return avgRelativeDeviation;
    }

    public void setAvgRelativeDeviation(double avgRelativeDeviation) {
        this.avgRelativeDeviation = avgRelativeDeviation;
    }

    public int getCategoryNumber() {
        return categoryNumber;
    }

    public void setCategoryNumber(int categoryNumber) {
        this.categoryNumber = categoryNumber;
    }

    public static String csvHeader(String... special){
        StringBuilder sb = new StringBuilder("\"size\",\"avg time\",\"avg rel deviation\",\"max rel deviation\"");
        for (String s : special) {
            sb.append(",\"");
            sb.append(s);
            sb.append("\"");
        }
        return sb.toString();
    }

    public String csvRow(String... specialValues){
        StringBuilder sb = new StringBuilder(String.format("%d,%d,\"%f\",\"%f\"",categoryNumber,averageTime, avgRelativeDeviation,maxRelativeDeviation));
        for (String s : specialValues) {
            sb.append(",\"");
            sb.append(s);
            sb.append("\"");
        }
        return sb.toString();
    }

    public double getMaxRelativeDeviation() {
        return maxRelativeDeviation;
    }

    public void setMaxRelativeDeviation(double maxRelativeDeviation) {
        this.maxRelativeDeviation = maxRelativeDeviation;
    }

}